function fctAssignValue()
{
	window.opener.document.getElementById("hla_pop_selection").value = document.getElementById("hla_pop_selection").value;
	window.opener.document.getElementById("hla_pop_selection2").value = document.getElementById("hla_pop_selection2").value;
	return false;
}
function ajaxPopSelHide()
{
	document.getElementById("pop_selection").style.visibility="hidden";
	document.getElementById("pop_selection").style.display="none";
	document.getElementById("pop_selection0").style.visibility="hidden";
	document.getElementById("pop_selection0").style.display="none";	
	return false;	
}
function ajaxPopSelShow()
{
	document.getElementById("pop_selection").style.visibility="visible";
	document.getElementById("pop_selection").style.display="";
	document.getElementById("pop_selection0").style.visibility="visible";
	document.getElementById("pop_selection0").style.display="";	
	return false;	
}
function ajaxPopSelClear()
{
  	var objElements = document.forms[0].elements;
  	var iTotElem = objElements.length;
  	var iI;
  
  	for(iI = 0; iI < iTotElem; iI++)
  	{
    	if(objElements[iI].type == "checkbox") 
		{ 
			objElements[iI].checked = false; 
		}
  	}
  	return false;
}
function fctFillPopSel(objElem)
{
	var objElements = document.forms[0].elements;	
  	var iTotElem = objElements.length;
  	var iI;
	var iSelected=0;
	var sString = "";
	var iMore_than_10 = 0;
	
  	for(iI = 0; iI < iTotElem; iI++)
  	{
    	if((objElements[iI].type == "checkbox")&&(objElements[iI].checked == true)&&(objElements[iI].name == "hla_pops"))
		{ 
				if (iSelected >= 20)
				{
						alert("Sorry, only 20 elements can be selected.");
						iMore_than_10 = 1;
						break;
				}
				else
				{						
						if (iSelected == 0)
						{
							sString = objElements[iI].value + "";
						}
						else
						{
							sString = sString + "," + objElements[iI].value + "";
						}
						iSelected = iSelected + 1;
				}
		}
  	}
	if ((iMore_than_10 > 0)&&(objElem.type == "checkbox"))
	{
		objElem.checked = false;
	}
	else
	{
		document.getElementById("hla_pop_selection").value=sString;
		document.getElementById("hla_pop_selection2").value=sString;
	}
  	return false;
}
function fctFillValues()
{
    var objElements = document.forms[0].elements;
  	var iTotElem = objElements.length;
  	var iI;
  	var iJ;
	var iTokens;
	var sTemp = "";
	var iLength = window.opener.document.getElementById("hla_pop_selection").value.length;
	var sChain = window.opener.document.getElementById("hla_pop_selection").value;
	var aSelected = new Array();
	
	document.getElementById("hla_pop_selection").value = window.opener.document.getElementById("hla_pop_selection").value;
	document.getElementById("hla_pop_selection2").value = window.opener.document.getElementById("hla_pop_selection2").value;	
	
	//... Cleaning variables ...//
	for (iI = 0; iI < 20; iI++)
	{
		aSelected[iI] = "";
	}
	
  	//... Detecting tokens ...//
	iTokens = 0;
	for (iI = 0; iI < iLength; iI++)
	{
		if((sChain.substring(iI, iI+1)==",")||(iI==iLength-1))
		{
			if(iI==(iLength-1))
			{
				aSelected[iTokens]=sTemp+sChain.substring(iI, iI+1);
			}
			else
			{
				aSelected[iTokens]=sTemp;
			}
			iTokens = iTokens + 1			
			sTemp = "";
		}
		else
		{
			sTemp = sTemp + sChain.substring(iI, iI+1);
		}
	}
	
	//... Comparing results ...//
  	for(iJ = 0; iJ < iTokens; iJ++)
	{
		for(iI = 0; iI < iTotElem; iI++)
		{
			if((objElements[iI].type == "checkbox")&&(objElements[iI].value == aSelected[iJ]))
			{ 
				objElements[iI].checked = true;
			}
		}
	}
  	return false;
}